const fs = require('fs')
const process = require('process')
const rs = fs.createReadStream('1.png')
const ws = fs.createWriteStream('2.png')

// rs.on('data', chunk => {
// 	console.log('chunk:', chunk)
// 	ws.write(chunk)
// })
// rs.on('end', () => {
// 	console.log('读取结束')
// 	console.log('内存用量：', process.memoryUsage()) // rss: 34357248,
// })


//可以用pipe函数代替上面一整个读取和写入过程
rs.pipe(ws)